<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<title>订单详情</title>
		<link type="text/css" rel="stylesheet" href="/fontsawesome/css/font-awesome.css"/>
		<link type="text/css" rel="stylesheet" href="/css/style.css"/>
	</head>
	<body>
		<div class="main_box">
			<div class="cont_box">
				<h2><span></span>销售退货</h2>
				<!--订单号-->
				<div class="search_box clearfix search_salesReturn">
					<label class="f_left">订单号：</label>
					<input type="search" placeholder="请输入订单号" class="f_left search_input orderId" th:value="${orderId}"/>
					<input type="button" value="确认" class="btn blue_btn"/>
				</div>
				<!--订单商品-->
				<div class="user_top order_top">订单商品：</div>
				<table border="0" cellspacing="0" cellpadding="0" class="table">
					<thead>
						<tr>
							<th>序号</th>
							<th>商品名称</th>
							<th>商品数量</th>
							<th>商品价格</th>
							<th>金额</th>
							<th>备注</th>
							<th>操作</th>
						</tr>
					</thead>
				</table>
			</div>
		</div>
		<!--javascript include-->
		<script src="/js/jquery-2.2.1.min.js"></script>
		<script src="/js/jquery.dataTables.min.js"></script>
		<script src="/js/bootstrap-datepicker.js"></script>
		<script src="/js/jquery.validate.min.js"></script>
		<script src="/js/jquery.form.min.js"></script>
		<script src="/js/other.js"></script>
	</body>
	<script th:inline="javascript" type="text/javascript">
		//查询是否存在订单
		$(".main_box .cont_box .search_salesReturn :button[value='确认']").bind("click",function () {
			var orderId = $(".search_box .orderId").val().trim();
			// alert(orderId);
			//表单验证
			if(orderId !=""){
				var reg1 = /^(\d)*$/;
				if(!reg1.test(orderId)){
					alert("订单号只能为数字,且数字中间不能有空格");
					return;
				}else if(orderId.length > 14){
					alert("请输入14位订单号");
					return;
				}
			}
			$.ajax({
				type:"post",
				url:"/sales/orderDetail/page",
				data:"orderId="+orderId+"&prevUrl=salesReturn",
				success:function(data){
					$(".table").next().remove();//删除之前新增的div
					$(".table").remove();//删除之前的table
					$(".cont_box").append(data);//加上查询出来的table
				},
				error:function(data){
					$.layerTip("error","数据不规范，请输入正确订单号！");
				}
			});
		})
	</script>

</html>